<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>cart</title>
  <script src="../vue.js"></script>
</head>
<body>
  <div id="root">
    <h1>产品列表</h1>
    <hr />
    <products @receive="handleReceive"></products>
    <h1>购物车</h1>
    <hr />
    <carts :product="product"></carts>
  </div>
  <script type="module">
    import './components/products.js'
    import './components/carts.js'

    Vue.config.productionTip = false
    var vm = new Vue({
      el: '#root',
      data: {
        product: {}
      },
      methods: {
        handleReceive(product) {
          this.product = product
        }
      },
    })
  </script>
</body>
</html>